package com.sunnada.edu.business.project.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sunnada.edu.system.pub.dao.BaseDaoImpl;

@Repository
public  class ProjectDaoImpl extends BaseDaoImpl implements ProjectDao {

	@Override
	public int getProjectCots(HashMap<String, String> params) {
		List list = selectList("project_sqlmap.getProjectCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findProjects(HashMap<String, String> params) {
		return selectList("project_sqlmap.findProjects", params);
	}
	
	


	@Override
	public int projectDelete(HashMap<String, String> params) {
		return delete("project_sqlmap.projectDelete", params);
	}

	@Override
	public int projectAdd(HashMap<String, String> params) {
		return insert("project_sqlmap.projectAdd", params);
	}
	


	@Override
	public int projectUpdate(HashMap<String, String> params) {
		return update("project_sqlmap.projectUpdate", params);
	}
	


	@Override
	public Map getProjectByRecId(HashMap<String, String> params) {
		List list = selectList("project_sqlmap.getProjectByRecId", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}

	@Override
	public Map<String, String> getProject(HashMap<String, String> params) {
		List list = selectList("project_sqlmap.getProject", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}


	@Override
	public int projectEnable(HashMap<String, String> params) {
		return update("project_sqlmap.projectEnable", params);
	}

	@Override
	public int projectDisable(HashMap<String, String> params) {
		return update("project_sqlmap.projectDisable", params);
	}



}
